package com.easy.easy.Service.impl;

import com.easy.easy.Service.IUserService;
import com.easy.easy.bean.User;
import com.easy.easy.dao.UserDao;
import com.easy.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
@Service
public class UserService implements IUserService {
    @Autowired
    UserDao userDao;

    @Override
    public int add(User user) {
        return userDao.add(user);
    }

    @Override
    public int delete(int id) {
        return userDao.delete(id);
    }

    @Override
    public int edit(User user) {
        return userDao.edit(user);
    }

    @Override
    public User getByID(int id) {
        return userDao.getByID(id);
    }

    @Override
    public List<User> getlist(Page page, String text) {
        return userDao.getList(page, text);
    }

    @Override
    public List<User> getChildren(int id) {
        return userDao.getChildren(id);
    }

    @Override
    public int getCount(String text) {
        return userDao.getCount(text);
    }

    @Override
    public User getUserByname(String username) {
        return userDao.getUserByUsername(username);
    }

    @Override
    public User getUser(User user) {
        return userDao.getUserByUsername(user.getUsername());
    }

}
